package com.distortiongames.escalol.components.render
{
	import com.distortiongames.elysium.math.Vector2D;
	import com.distortiongames.escalol.components.render.settings.FillSettings;
	import com.distortiongames.escalol.components.render.settings.StrokeSettings;
	import com.pblabs.core.PBComponent;
	import flash.display.Sprite;
	
	/**
	 * ...
	 * @author Jefferson Wagner
	 */
	public class CircleRenderer extends Renderer
	{
		//{ region Fields
		private var _stroke:StrokeSettings = new StrokeSettings();
		private var _fill:FillSettings = new FillSettings();
		private var _position:Vector2D = new Vector2D();
		private var _radius:Number = 0;
		
		//}
		
		//{ region Properties
		public function get stroke():StrokeSettings
		{
			return _stroke;
		}
		
		public function set stroke(value:StrokeSettings):void
		{
			_stroke = value;
			dirty = true;
		}
		
		public function get fill():FillSettings
		{
			return _fill;
		}
		
		public function set fill(value:FillSettings):void
		{
			_fill = value;
			dirty = true;
		}
		
		public function get position():Vector2D
		{
			return _position;
		}
		
		public function set position(value:Vector2D):void
		{
			dirty = true;
			_position = value;
		}
		
		public function get radius():Number
		{
			return _radius;
		}
		
		public function set radius(value:Number):void
		{
			_radius = value;
			dirty = true;
		}
		
		//}
		
		override public function doRender():void
		{
			super.doRender();
			sprite.graphics.clear();
			sprite.graphics.lineStyle(_stroke.weight, _stroke.color, _stroke.alpha);
			sprite.graphics.beginFill(_fill.color, _fill.alpha);
			sprite.graphics.drawCircle(_position.x, _position.y, _radius);
		}
	}

}